/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.i.kotionokyurievna.jewelryweb.entities;

import java.util.HashMap;
import javax.persistence.*;
import ua.i.kotionokyurievna.jewelryweb.entities.Product;

/**
 *
 * @author Kateryna_Reznik
 */
@Entity
@Table (name="productcatalogs")
public class ProductCatalog {
    @Id
    @Column (name="productcatalogue_id")
    private int productCatalogId;
    @Transient
    private HashMap<Product, Integer> products;
    private String clause;
    @Column (name="product_name")
    private String productName;
    @Column (name = "is_catalogue")
    private boolean isCatalogue;

    public ProductCatalog() {
    }

    public ProductCatalog(HashMap<Product, Integer> products, String clause, 
            String productName, boolean isCatalogue) {
        this.products = products;
        this.clause = clause;
        this.productName = productName;
        this.isCatalogue = isCatalogue;
    }

    public ProductCatalog(int productCatalogId, 
            HashMap<Product, Integer> products, 
            String clause, String productName, boolean isCatalogue) {
        this.productCatalogId = productCatalogId;
        this.products = products;
        this.clause = clause;
        this.productName = productName;
        this.isCatalogue = isCatalogue;
    }

    public int getProductCatalogId() {
        return productCatalogId;
    }

    public HashMap<Product, Integer> getProducts() {
        return products;
    }

    public void setProducts(HashMap<Product, Integer> products) {
        this.products = products;
    }

    public String getClause() {
        return clause;
    }

    public void setClause(String clause) {
        this.clause = clause;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public boolean isIsCatalogue() {
        return isCatalogue;
    }

    public void setIsCatalogue(boolean isCatalogue) {
        this.isCatalogue = isCatalogue;
    }

    @Override
    public String toString() {
        return "ProductCatalog{" + "productCatalogId=" + productCatalogId + 
                ", products=" + products + ", clause=" + clause + 
                ", productName=" + productName + ", isCatalogue=" + 
                isCatalogue + '}';
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 23 * hash + (this.clause != null ? this.clause.hashCode() : 0);
        hash = 23 * hash + (this.productName != null ? this.productName.hashCode() : 0);
        hash = 23 * hash + (this.isCatalogue ? 1 : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProductCatalog other = (ProductCatalog) obj;
        if ((this.clause == null) ? (other.clause != null) : 
                !this.clause.equals(other.clause)) {
            return false;
        }
        if ((this.productName == null) ? (other.productName != null) : 
                !this.productName.equals(other.productName)) {
            return false;
        }
        if (this.isCatalogue != other.isCatalogue) {
            return false;
        }
        return true;
    }
    
    
}
